package bankaccount;

public class WithdrawRunnable implements Runnable {
    private BankAccount account;
    private int amount;

    public WithdrawRunnable(BankAccount account, int amount) {
        this.account = account;
        this.amount = amount;
    }

    @Override
    public void run() {
        while (true) {
            account.withdraw(amount);
            if (account.getBalance() <= 0) {
                break;
            }
        }
    }
}
